#ifndef MODIFY_H
#define MODIFY_H

#include <QWidget>
#include <QTcpSocket>

namespace Ui {
class Modify;
}

class Modify : public QWidget
{
    Q_OBJECT

public:
    explicit Modify(const QString &employeeId, QWidget *parent = nullptr);
    ~Modify();

protected:
    // 用于拖动窗口的事件处理函数
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;

    void paintEvent(QPaintEvent *event) override;

private slots:
    void on_returnButton_clicked();

    void readFromServer();

    void on_yes_clicked();

    void on_no_clicked();

private:
    Ui::Modify *ui;
    QString employeeId;  // 存储工号
    QTcpSocket *tcpSocket;  // TCP套接字
    void sendPasswordChangeRequest(const QString &oldPassword, const QString &newPassword);

    // 用于记录拖动时鼠标位置的成员变量
    QPoint m_dragPosition;

    // 添加用于判断是否点击标题栏的成员变量
    bool m_isTitleBarClicked = false;
};

#endif // MODIFY_H
